package com.ma.server.Impl;

import com.ma.Dao.MessageDao;
import com.ma.entity.Message;
import com.ma.server.MessageServe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ProjectName: project
 * @Package: com.ma.server.Impl
 * @ClassName: MessageServerImpl
 * @Author: YHHHH
 * @Description:
 * @Date: 2021/3/20 14:58
 * @Version: 1.0
 */
@Service
@Transactional
public class MessageServerImpl implements MessageServe {

    @Autowired
    private MessageDao messageDao;

    @Override
    public List<Message> findById(String receiveID) {
        List<Message> findByID = messageDao.findByID(receiveID);

        return findByID;
    }

    @Override
    public Integer addMessage(Message message) {
        Integer integer = messageDao.addMessage(message);
        return integer;
    }

    @Override
    public List<Message> findReadedMessage(String receiveID) {
        List<Message> readedMessage = messageDao.findReadedMessage(receiveID);
        return readedMessage;
    }

    @Override
    public Integer updateState(Integer id) {
        Integer state = messageDao.updateState(id);
        return state;
    }

    @Override
    public List<Message> teacherMessage(String receiveID) {
        messageDao.teacherMessage(receiveID);
        return null;
    }
}
